import request from './request'

import { selectCondition, selectDetail } from '@/constants/commonSelect'

export function selectConfig() {
  return request({
    url: '/common/select/config',
    method: 'get',
  })
}

export async function getGroupDetail(group: string) {
  let data: selectCondition[] = []
  const res = await selectConfig()
  data = res.data
  const dataGroup = data.find((item) => item.group === group)
  return dataGroup ? dataGroup.groupDetail : []
}

export function commonUpload(data: any) {
  return request({
    url: '/common/upload',
    method: 'post',
    data: data,
    headers: {
      'Content-Type':
        'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
    },
  })
}
